package ModelLayer;
import java.util.ArrayList;
import java.util.Date;

public class SalesRental {

	private int invoiceNo;
	private Date date;
	private double amount;
	private int cid;
	private ArrayList<LineItem> lineItems;
	
	public SalesRental(){
		lineItems = new ArrayList<>();
	}
	
	public SalesRental(int invoiceNo, Date date, double amount, int cid) 
	{
		this();
		this.invoiceNo = invoiceNo;
		this.date = date;
		this.amount = amount;
		this.cid = cid;
	}

	
	
	public void setLineItem(ArrayList<LineItem> lineitems)
	{
		this.lineItems = lineItems;
	}
	
	public void addProduct(int prid, int quantity){
		LineItem lineItem = new LineItem(prid, quantity, getInvoiceNo());
		lineItems.add(lineItem);
	}
	
	public void removeProduct(int prid){
		for(LineItem litem : lineItems)
		{
			if(litem.getPrid() == prid) lineItems.remove(litem);
		}
	}
	
	public ArrayList<LineItem> getProducts(){
		return lineItems;
	}
	

	public int getInvoiceNo() {
		return invoiceNo;
	}

	public void setInvoiceNo(int invoiceNo) {
		this.invoiceNo = invoiceNo;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}

	public int getCid() {
		return cid;
	}

	public void setCid(int cid) {
		this.cid = cid;
	}
	
	
	
}
